/*! \file loops.h
	\author HiddenSeeker

	Defines a loops nodes
*/
#include "../abstractnode.h"
#pragma once

class MethodSelectDelegate;

/*! From loop node
*/
class FromLoopNode: public AbstractNode
{
 private:
          AbstractNode * m_from;
		  AbstractNode * m_cond;
		  AbstractNode * m_loop;

		  unsigned short m_get_boolean;
		  /*! A conditions for code generation of methods
		   */
		  std::vector<MethodSelectDelegate *> m_applied;
 public:
	     inline FromLoopNode(const YYLTYPE & pos,
			                 AbstractNode * f, 
							 AbstractNode * c, 
							 AbstractNode * l): AbstractNode(pos)
		 {
			 m_from=f;
			 m_cond=c;
			 m_loop=l;
		 }
		 /*! Transforms a code, if needed to
			\return true on success
		 */
		 virtual bool checkLogic(ParentData * data); 
		 /*! Checks common errors
		 */
		 virtual void checkCommonErrors(ParentData * data);
		 /*! Transforms a code, if needed to
			\return true on success
		 */
		 virtual bool transformCode(ParentData * data);
		 /*! Writes a node data to stream
		  */
		 virtual void write(GraphStream * s);
		 /*! Fills a constant table for method
		  */
		 virtual void fillConstant(ParentData * data);
		 /*! Produces a code for method
		  */
		 virtual void produceCode(ParentData * data);
		 ~FromLoopNode();
};
